<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Homepage</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <link rel="stylesheet" href="css/mycss.css" type="text/css"></link>
    </h:head>

    <body style="background-color:#F0FFFF"></body>

    <h:body>

        <h:form>
            <p:growl id="messages" showDetail="true" />
            <br/>

            <center>
                <p:button outcome="/user/event/newEvent" value ="Create Event" style="width:200px;height:60px; background-color:#90A4FD"/>
                <p:button outcome="/user/invite/showInvites" value="INVITES: #{counter.invitesnumber}" style="width:150px;height:60px; background-color:#90A4FD"/>
                <p:button outcome="/user/update/showUpdates" value="UPDATES: #{counter.updatesnumber}" style="width:150px;height:60px; background-color:#90A4FD"/>
                <p:button outcome="/user/delete/showDeletes" value="DELETES: #{counter.deletesnumber}" style="width:150px;height:60px; background-color:#90A4FD"/>
                <p:button outcome="/user/tomorrowRainy/showTomorrowRainy" value="TOMORROW RAINY: #{counter.tmrnumber}" style="width:250px;height:60px; background-color:#90A4FD"/>
                <p:button outcome="/user/badWeather/showBadWeather" value="BAD WEATHER: #{counter.badweathernumber}" style="width:250px;height:60px;background-color:#90A4FD"/>
            </center>
            <br/><br/>
            <right>
                <p:inputText style="position: absolute; right: 200px; height: 25px;" id="search" value="#{searchBean.search}"/>
                <p:commandButton style="position: absolute; right: 95px; width:100px; height: 35px; background-color:#90A4FD" value="Search" action="#{searchBean.searchUser}" />
            </right>




            <br/><br/><br/><br/>
            <p:schedule value="#{secondScheduleBean.eventModel}" widgetVar="myschedule" timeZone="GMT+1">
                <p:ajax event="eventSelect" listener="#{secondScheduleBean.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
                <p:ajax event="eventMove" listener="#{secondScheduleBean.onEventMove}" update="messages" />
                <p:ajax event="eventResize" listener="#{secondScheduleBean.onEventResize}" update="messages" />
            </p:schedule>



            <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
                <h:panelGrid id="eventDetails" columns="2">

                    <br/><p:dataTable id="eventDetail"
                                      var="sb"  style="width: 1299px"
                                      value="#{secondScheduleBean.list}">



                        <p:column  headerText="Name" style="width:180px;text-align:center">
                            <h:outputText value="#{sb.eventname}"/>
                        </p:column>

                        <p:column headerText="City" style="width:85px;text-align:center">
                            <h:outputText value="#{sb.city}"/>
                        </p:column>

                        <p:column headerText="Place" style="width:100px;text-align:center">
                            <h:outputText value="#{sb.place}"/>
                        </p:column>

                        <p:column headerText="Date" style="width:85px;text-align:center">
                            <h:outputText value="#{sb.eventdate}"/>
                        </p:column>

                        <p:column headerText="Start Time" style="width:40px;text-align:center">
                            <h:outputText value="#{sb.timestart}"/>

                        </p:column><p:column headerText="End Time" style="width:40px;text-align:center">
                            <h:outputText value="#{sb.timefinish}"/>
                        </p:column>

                        <p:column headerText="Type" style="width:75px;text-align:center">
                            <h:outputText value="#{sb.eventtype}"/>
                        </p:column>

                        <p:column headerText="Visibility" style="width:80px;text-align:center">
                            <h:outputText value="#{sb.visibility}"/>
                        </p:column> 

                        <p:column headerText="Weather" style="width:80px;text-align:center">
                            <h:outputText value="#{sb.weather}"/>
                        </p:column>

                        <p:column headerText="Creator" style="width:200px;text-align:center">
                            <h:outputText value="#{sb.creator}"/>
                        </p:column>

                        <p:column headerText="Edit" style="width:40px;text-align:center">
                            <h:link value="Edit" outcome="/user/event/editEvent">
                                <f:param name="id" value="#{secondScheduleBean.ourEvent.eventid}" />
                                <f:param name="name" value="#{secondScheduleBean.ourEvent.eventname}" />
                                <f:param name="city" value="#{secondScheduleBean.ourEvent.city}" />
                                <f:param name="place" value="#{secondScheduleBean.ourEvent.place}" />
                                <f:param name="date" value="#{secondScheduleBean.ourEvent.eventdate}" />
                                <f:param name="type" value="#{secondScheduleBean.ourEvent.eventtype}" />
                                <f:param name="visibility" value="#{secondScheduleBean.ourEvent.visibility}" />
                                <f:param name="creator" value="#{secondScheduleBean.ourEvent.creator}" />
                                <f:param name="weather" value="#{secondScheduleBean.ourEvent.weather}" />
                                <f:param name="timestart" value="#{secondScheduleBean.ourEvent.timestart}" />
                                <f:param name="timefinish" value="#{secondScheduleBean.ourEvent.timefinish}" />
                            </h:link>
                        </p:column>

                        <p:column headerText="Delete" style="width:50px;text-align:center">
                            <p:commandButton icon="ui-icon-trash"
                                             action="#{deleteEventBean.DeleteEvent(
                                                       sb.id,
                                                       sb.eventname,
                                                       sb.place,
                                                       sb.eventdate,
                                                       sb.visibility,
                                                       sb.creator, 
                                                       sb.eventdate,
                                                       sb.city,
                                                       sb.weather)}"
                                             style="width:40px;height:30px"/>
                        </p:column>

                    </p:dataTable>




                </h:panelGrid>

            </p:dialog>
            <br/>
            <h:commandLink action="#{loginBean.logout()}" value="Logout" />


            #{weatherBean.checkTomorrowRainy()}<br/>
            #{weatherBean.checkBadWeather()}

        </h:form>

    </h:body>
</html>